<div class='fui-page fui-page-current order-pay-page'>
    <div class="fui-header">
         <div class="title" >支付订单</div>
    </div>
    <div class='fui-content margin'>
        <div class="fui-cell-group">
            <div class="fui-cell">
                <div class="fui-cell-label">支付单号</div>
                <div class="fui-cell-info">{{pagedata.tid}}</div>
            </div>
            <div class="fui-cell">
                <div class="fui-cell-label">订单金额</div>
                <div class="fui-cell-info"><span class='text-danger'>￥{{pagedata.fee}}</span></div>
            </div>
        </div>
        <div class='fui-list-group' style="margin-top:10px;">
			<a ng-show="pagedata.fee == 0" class="btn btn-success block" href="javascript:" ng-click="credit()">确认支付</a>
			<div ng-show="pagedata.fee>0">
				<div class='fui-list pay-btn' ng-show="pagedata.credit" ng-click="credit()">
					<div class='fui-list-media'>
						<i class="icon icon-caifua credit"></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">余额支付</div>
						<div class="subtitle">当前账户余额: <span class='text-danger'>￥{{pagedata.credit2}}</span>
						</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list pay-btn' ng-show="pagedata.wechat" ng-click="wechat()">
					<div class='fui-list-media'>
						<i class='icon icon-weixin1 wechat'></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">微信支付</div>
						<div class="subtitle">微信安全支付</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list js-webwxapp-pay hide' ng-show="pagedata.wechat">
					<div class='fui-list-media'>
						<i class='icon jinyunicon icon-xiaochengxu wechat'></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">微信支付</div>
						<div class="subtitle">微信小程序安全支付</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list pay-btn' ng-show="pagedata.alipay" ng-click="alipay()">
					<div class='fui-list-media'>
						<i class='icon jinyunicon icon-qianbaopengyou alipay'></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">支付宝支付</div>
						<div class="subtitle">使用支付宝进行支付</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list pay-btn' ng-show="pagedata.hdfk" ng-click="hdfk()">
					<div class='fui-list-media'>
						<i class='fa fa-yen cash'></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">货到付款</div>
						<div class="subtitle">收到商品后进行付款</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list pay-btn' ng-show="pagedata.vip8173888" ng-click="vip8173888()">
					<div class='fui-list-media'>
						<i class='fa fa-yen vip8173888'></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">快捷支付</div>
						<div class="subtitle">第三方快捷支付平台</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
				<div class='fui-list pay-btn' ng-show="pagedata.df" ng-click="df()">
					<div class='fui-list-media'>
						<i class='fa fa-yen peerpay' style="background: #ff9326;color: #fff"></i>
					</div>
					<div class='fui-list-inner'>
						<div class="title">微信找人代付</div>
						<div class="subtitle">帮你付款的才是真爱</div>
					</div>
					<div class='fui-list-angle'><span class="angle"></span></div>
				</div>
			</div>
         </div>
    </div>
</div>
<script>
window.scope.credit=function(){
	scope.confirm({
		'message':'确认要支付吗？',
		'success':function(){
			//alert('准备支付');
			window.scope.post({'id':window.scope.pagedata.id},'credit','',function(res){
				window.scope.post({'status':'success','type':'credit','id':window.scope.pagedata.id},'pay_result');
			});
		},
		'fail':function(){}
	});
}
window.scope.wechat=function(){
	window.scope.post({'id':window.scope.pagedata.id},'wechat','',function(data){
			WeixinJSBridge.invoke('getBrandWCPayRequest', data, function(res) {
				if(res.err_msg == 'get_brand_wcpay_request:ok'){
					//支付成功回调
					window.scope.post({'status':'success','type':'wechat','id':window.scope.pagedata.id},'pay_result');
				}else if(res.err_msg == 'get_brand_wcpay_request:cancel'){
					
				}else{
					//alert(res.err_msg);
					window.scope.message('启动微信支付失败, 请选择其他支付方式. 详细错误为: ' + res.err_msg,'error');
				}
			});
	});
}
wx.miniProgram.getEnv(function(res) {
	if(res.miniprogram) {
		$('.pay-btn').hide();
		$('.js-webwxapp-pay').removeClass('hide');
		$('.js-webwxapp-pay').show();
		$('.js-webwxapp-pay').click(function(){
			wx.miniProgram.navigateTo({
				url: "/pages/pay/pay?orderid="+window.scope.pagedata.id
			});
		});
	}else{
		$('.pay-btn').removeClass('hide');
		$('.pay-btn').show();
	}
});
</script>